#include "../Http.hpp"

#include <unistd.h>
#include <assert.h>

int main()
{
    Socket clisock;
    clisock.CreateClinet("127.0.0.1",9090);
    std::string req = "PUT /1234.txt HTTP/1.1\r\nConnection: keep-alive\r\n";
    std::string body;
    Util::ReadFile("./hello.txt", &body);
    req += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n";

    assert(clisock.Send(req.c_str(), req.size()) != -1);
    assert(clisock.Send(body.c_str(), body.size()) != -1);

    char buffer[1024] = {0};
    clisock.Recv(buffer,sizeof(buffer) - 1);
    DEBUG_LOG("[%s]",buffer);
    sleep(3);
    clisock.Close();
    return 0;
}